package com.sghj.record.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sghj.config.handler.ResultCode;
import com.sghj.config.handler.exceptionHandler.MyException;
import com.sghj.record.entity.RecordOutcall;
import com.sghj.record.entity.dto.RecordIncallQuery;
import com.sghj.record.entity.dto.RecordOutcallQuery;
import com.sghj.record.entity.vo.RecordIncallRes;
import com.sghj.record.entity.vo.RecordOutcallRes;
import com.sghj.record.mapper.RecordOutcallMapper;
import com.sghj.record.service.RecordOutcallService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author zhongkai
 * @since 2024-07-15
 */
@Service
public class RecordOutcallServiceImpl extends ServiceImpl<RecordOutcallMapper, RecordOutcall> implements RecordOutcallService {

    @Override
    public IPage<RecordOutcallRes> getRecordOutcallPage(RecordOutcallQuery query, Page<RecordOutcallRes> page) {
        return baseMapper.getRecordOutcallPage(page, query);
    }

    @Override
    public List<RecordOutcallRes> getRecordOutcallByDayPlanNumber(Integer dayPlanNumber) {
        return baseMapper.getRecordOutcallByDayPlanNumber(dayPlanNumber);
    }

    @Override
    public List<RecordOutcallRes> getRecordOutcallList(RecordOutcallQuery query) {
        if (query == null || query.getQueryStartTime() == null || query.getQueryEndTime() == null){
            throw new MyException(ResultCode.FAIL,"查询条件不足");
        }
        return baseMapper.getRecordOutcallList(query);
    }
}
